package com.company.MovieAnalyse.analyse1;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;

import org.apache.hadoop.fs.FsUrlStreamHandlerFactory;
import org.apache.hadoop.yarn.api.records.URL;
import org.apache.jasper.tagplugins.jstl.core.Url;

public class JobMain  {
    //该方法用于指定一个job任务
    public static void main(String[] args) throws Exception {

        Job job = Job.getInstance(new Configuration(), "movies");

        //设置驱动方法
       job.setJarByClass(JobMain.class);

        //设置map,reduce
        job.setMapperClass(WordCountMapper.class);
        job.setReducerClass(WordCountReducer.class);

        //设置map
        job.setMapOutputKeyClass(Text.class);
        job.setMapOutputValueClass(Text.class);

        //设置reduce
        job.setOutputKeyClass(Text.class);
        job.setOutputValueClass(Text.class);

        //输入输出路径
        FileInputFormat.addInputPath(job,new Path("J:\\the_efforts_paid_offf\\HDFS_HBase_HiveApi\\src\\main\\java\\com\\company\\datas\\douban.txt"));
        FileOutputFormat.setOutputPath(job,new Path("J:\\the_efforts_paid_offf\\HDFS_HBase_HiveApi\\src\\main\\java\\com\\company\\output\\a1"));

        boolean b = job.waitForCompletion(true);
        System.exit(b?0:1);

        FsUrlStreamHandlerFactory factory = new FsUrlStreamHandlerFactory();

    }
}

